<?php

// $Id: add.php 831 2008-04-16 19:34:25Z doc $

/*

 Website Baker Project <http://www.websitebaker.org/>
 Copyright (C) 2004-2008, Ryan Djurovich

 Website Baker is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or
 (at your option) any later version.

 Website Baker is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with Website Baker; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

*/

// Create new admin object and print admin header
require('config.php');
require_once(WB_PATH.'/framework/class.admin.php');
//$admin = new admin('Pages', 'pages_add');

// Include the WB functions file
require_once(WB_PATH.'/framework/functions.php');



// 
$get_all_pages = $database->query("SELECT page_id, link, level FROM ".TABLE_PREFIX."pages");

//create_access_file(WB_PATH.PAGES_DIRECTORY.'/test', 18, 0);
//die();

if($get_all_pages->numRows() > 0) {

	while($fetch_pages = $get_all_pages->fetchRow()) {
		$page_id = $fetch_pages['page_id'];
		$link = $fetch_pages['link'];
		$level = $fetch_pages['level'];
		
		echo $page_id .' '. WB_PATH.PAGES_DIRECTORY.$link.PAGE_EXTENSION.' '. $level . '<br>';
		
		
		// Create a new file in the /pages dir
		create_access_file(WB_PATH.PAGES_DIRECTORY.$link.PAGE_EXTENSION, $page_id, $level);
		//create_access_file($link.PAGE_EXTENSION, $page_id, $level);
		
	}
}


?>